import request from '@/utils/request'

// 获取渠道设置
export function getBusinesspay(params: any) {
  return request({
    url: '/scrm-api/console/tenant/corp/get-business-pay',
    params
  })
}
// 企业支付渠道配置
export function setBusinesspay(data: any) {
  const form = new FormData()
  form.append('merchant_sn', data.merchant_sn)
  form.append('pay_secret', data.pay_secret)
  form.append('wx_corp_id', data.wx_corp_id)
  form.append('merchant_certificate_serial', data.merchant_certificate_serial)
  // form.append('apiclient_cert', data.apiclient[0].raw)
  // form.append('apiclient_key', data.apiclient[1].raw)

  return request({
    url: '/scrm-api/console/tenant/corp/set-business-pay',
    method: 'POST',
    data: form
  })
}
// 保存支付证书
export function setSavePem(data: any) {
  const form = new FormData()
  form.append('apiclient_cert', data.apiclient_cert)
  form.append('apiclient_key', data.apiclient_key)

  return request({
    url: '/scrm-api/console/tenant/corp/save-pem',
    method: 'post',
    data: form
  })
}
